﻿Public Class BorrowingCart
    Inherits System.Web.UI.Page
    Dim mt As New MuonTra_BLL()
    Dim mtc As New MuonTra_DTO()
    Dim objUser As New LoginHelper("", "")
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub


    Protected Sub se_soluong_Init(ByVal sender As Object, ByVal e As EventArgs) Handles se_soluong.Init
        se_soluong.MaxValue = Request.QueryString("soluong")
        se_soluong.MinValue = 1
    End Sub
    Protected Sub xacnhanMuon(ByVal sender As Object, ByVal e As EventArgs) Handles a_muon.ServerClick
        Try
            objUser = TryCast(Session("sesLoginUser"), LoginHelper)
            mtc._idsach = Request.QueryString("id_sach")
            mtc._kieumuon = cbb_kieumuon.SelectedItem.Value
            mtc._soluongsach = se_soluong.Text
            mtc._taikhoan = objUser.UserName
            mtc._ngaytra = date_ngayhentra.Text
            mtc._tensach = Request.QueryString("tensach")
            mt.themMuonTuDocGia(mtc)
            ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('Đăng Ký Mượn Thành Công - Quay Về Trang Chủ');gobackDeafault();", True)
        Catch
            ScriptManager.RegisterStartupScript(Me, [GetType](), "showalert", "alert('Đăng Ký Mượn Thất Bại');", True)
        End Try

    End Sub

    Protected Sub date_ngayhentra_Init(ByVal sender As Object, ByVal e As EventArgs) Handles date_ngayhentra.Init
        date_ngayhentra.MinDate = Date.Today.AddDays(0)
        date_ngayhentra.Date = Date.Now()
    End Sub
End Class